package com.share.netdisk.user.model;

public class UserContext {
    private static final ThreadLocal<User> userHolder = new ThreadLocal<>();

    // 设置当前线程的用户信息
    public static void setUser(User user) {
        userHolder.set(user);
    }

    // 获取当前线程的用户信息
    public static User getUser() {
        return userHolder.get();
    }

    // 清除当前线程的用户信息
    public static void clearUser() {
        userHolder.remove();
    }
}
